<?php $this->load->view('teacher_home/_header') ?>
<?php $this->load->view('message') ?>
<script tyep="text/javascript">
  $().ready(function(){
    $("#student_li").addClass("active"); 
    $("#logic_class_add_form").validate({
        rules:{

            logic_class_name:
            {
                required:true,
                maxlength:45,
                remote: {
                    url: "<?php echo site_url('teacher_student/check_logic_class_name_exist')?>",     //后台处理程序
                    type: "post",               //数据发送方式 
                    dataType: "json",           //接受数据格式  
                    data: {                     //要传递的数据,
                        school_id: function() {
                            return $("#school_id").val();
                        },
                        logic_class_number: function() {
                            return $("#logic_class_name").val();
                        }
                    }
                }
            },
            big_lecture_id:
            {
                required:true
            }
        },
        messages:
        {
            logic_class_name:
            {
                remote:"这个班级名称已存在"
            }
        }
        
    });   
  });
</script> 

<div class="container">
    <div class="panel panel-primary">
        <div class="panel-heading">
            <h3 class="panel-title">添加授课班</h3>
        </div>
        <div class="panel-body">
            <?php echo validation_errors(); ?>
            <form id="logic_class_add_form" method="post" class="form-horizontal"  enctype="multipart/form-data" action="<?php echo site_url('teacher_student/logic_class_add')?>" >
                <fieldset>
                    <!-- <div class="form-group">
                        <label class="col-lg-2 control-label">课程名称:</label>
                        <div class="col-lg-8">
                            <input class="form-control" id="logic_class_name" name="logic_class_name"/>
                        </div>

                    </div> -->
                    <input type="int" id="teacher_id" name="teacher_id" value="<?=$teacher_id?>" class="hidden">
                    <input type="int" id="school_id" name="school_id" value="<?=$school_id?>" class="hidden">
                    <div class="form-group">
                        <label class="col-lg-2 control-label">课程:</label>
                        <div class="col-lg-8">
                            <select class="form-control" name="big_lecture_id" id="big_lecture_id">
                                <?php foreach ($big_lectures as $item) :?>
                                    <option value="<?=$item['id']?>">
                                        <?=$item['name']?>
                                    </option>
                                <?php endforeach; ?>
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-lg-2 control-label">班级名称:</label>
                        <div class="col-lg-8">
                            <input class="form-control" id="logic_class_name" name="logic_class_name" placeholder="班级名称禁止重复，请考虑班级的年级和专业信息，如2016级电气工程1班"/>
                        </div>

                    </div>
                    <div class="form-group">
                        <div class="col-lg-10 col-lg-offset-2">
                            <button type="submit" class="btn btn-primary">提交</button>
                        </div>
                    </div>
                </fieldset>
            </form>
        </div>
    </div>
</div>

<?php $this->load->view('teacher_home/_footer')?>